//
//  BwhcViewController.m
//  YiqiMobile
//
//  Created by henry on 13-4-6.
//  Copyright (c) 2013年 henry. All rights reserved.
//

#import "BwhcViewController.h"
#import "Config.h"
#import "Utility.h"
#import "BwhcViewCell.h"

@interface BwhcViewController ()

@end

@implementation BwhcViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
     self.navigationItem.titleView=[Utility getTitleView:@"博文荟萃"];
    self.arrayList=[NSMutableArray array];
    
    self.bwhcTopMenu=[[BwhcTopMenu alloc] initWithFrame:CGRectMake(0, 0, 320, 38)];
    self.bwhcTopMenu.delegate=self;
    NSMutableArray *param=[NSMutableArray array];
    [param addObject:@{@"name":@"生活娱乐",@"id":@"1"}];
    [param addObject:@{@"name":@"思想文化",@"id":@"2"}];
    [param addObject:@{@"name":@"社会创新",@"id":@"3"}];
    [param addObject:@{@"name":@"商家活动",@"id":@"4"}];
    [param addObject:@{@"name":@"生活娱乐",@"id":@"5"}];
    [param addObject:@{@"name":@"社会创新",@"id":@"6"}];
    [param addObject:@{@"name":@"商家活动",@"id":@"7"}];
    [param addObject:@{@"name":@"生活娱乐",@"id":@"8"}];
    [self.bwhcTopMenu showData:param andPadding:6.0];
    [self.view addSubview:self.bwhcTopMenu];
    
	// Do any additional setup after loading the view.
    
    float tableHeight=self.view.frame.size.height-self.navigationController.navigationBar.frame.size.height-self.bwhcTopMenu.frame.size.height;
    CGRect tableViewFrame=CGRectMake(0, self.bwhcTopMenu.frame.size.height, UISCREEN_WIDTH, tableHeight);
    self.mytableView=[[UITableView alloc] initWithFrame:tableViewFrame];
    self.mytableView.tag=HOMEPAGETABLEVIEWTAG;
    self.mytableView.delegate=self;
    self.mytableView.dataSource=self;
    self.mytableView.separatorStyle=UITableViewCellEditingStyleNone;
    [self.view addSubview:self.mytableView];
    self.arrayList=[NSMutableArray array];
    [self.arrayList addObjectsFromArray:@[@"1",@"2",@"1",@"2",@"1",@"2",@"1",@"2",@"1",@"2",@"1",@"2"]];
}

//表视图委托
#pragma mark -
#pragma mark table view data source methods

//返回某个表视图有多少行数据
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.arrayList count];
}

//设置行高度
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

//表视图显示表视图项时调用：第一次显示（根据视图大小显示多少个视图项就调用多少次）以及拖动时调用
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    static NSString *CellIdentifier = @"bwhcCell";
    
    BwhcViewCell *cell =(BwhcViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[BwhcViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier: CellIdentifier];
    }

    return cell;
}








-(void) onclickScrollButton:(NSUInteger)category{
    NSLog(@"buttontag=%d",category);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
